#include <machine/asm.h>

/* int / int */
#ifndef __mc68010__
ENTRY(__divsi3)
	movel	4(%sp),%d0
	divsl	8(%sp),%d0
	rts
END(__divsi3)
#else
ENTRY(__divsi3)
| NB: this requires that __udivsi3 preserve %a0:
	movel	4(%sp), %d1	| load the dividend
	bpl	1f
	negl	4(%sp)		| store abs(dividend)
1:	movel	8(%sp), %d0	| load the divisor
	bpl	2f
	negl	8(%sp)		| store abs(divisor)
2:	eorl	%d1, %d0
	bpl	3f		| branch if sgn(divisor) == sgn(dividend)
	movel	(%sp)+, %a0	| pop return address
	pea	(.Lret,%pc)	| push our return address
3:	jmp	_C_LABEL(__udivsi3)
.Lret:	negl	%d0		| negate quotient
	jmp	(%a0)
END(__divsi3)
#endif /* __mc68010__ */
